package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.dao.LXqgx;
import com.ruoyi.service.ILXqgxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;


import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 【请填写功能名称】Controller
 * 
 * @author zxw
 * @date 2025-07-09
 */
@Api(tags = "业务——小区管线管理")
@RestController
@RequestMapping("/admin/xqgx")
public class LXqgxController extends BaseController
{
    @Autowired
    private ILXqgxService lXqgxService;

    /**
     * 查询【请填写功能名称】列表
     */
    @GetMapping("/list")
    @ApiOperation("多条件查询小区管线")
    public TableDataInfo list(LXqgx lXqgx)
    {
        startPage();
        List<LXqgx> list = lXqgxService.selectLXqgxList(lXqgx);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */

    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LXqgx lXqgx)
    {
        List<LXqgx> list = lXqgxService.selectLXqgxList(lXqgx);
        ExcelUtil<LXqgx> util = new ExcelUtil<LXqgx>(LXqgx.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('controller:xqgx:query')")
    @GetMapping(value = "/{gid}")
    public AjaxResult getInfo(@PathVariable("gid") Long gid)
    {
        return success(lXqgxService.selectLXqgxByGid(gid));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('controller:xqgx:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LXqgx lXqgx)
    {
        return toAjax(lXqgxService.insertLXqgx(lXqgx));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('controller:xqgx:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LXqgx lXqgx)
    {
        return toAjax(lXqgxService.updateLXqgx(lXqgx));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('controller:xqgx:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{gids}")
    public AjaxResult remove(@PathVariable Long[] gids)
    {
        return toAjax(lXqgxService.deleteLXqgxByGids(gids));
    }

    @ApiOperation("小区管线道路唯一值")
    @GetMapping(value = "/estateDistinct")
    public AjaxResult estateDistinct()
    {
        return success(lXqgxService.estateDistinct());
    }



}
